package com.kiragame.xchat.object;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

public class SaveStateConfig {
	private String hideChatUserID = null;
	private String hideChatUserName = null;
	private MainDisplayState mDisplayState = MainDisplayState.ROOM_STATUS;
	private HideChatBarState mHideChatBarState = HideChatBarState.CHAT_ROOM;

	public String getHideChatUserID() {
		return hideChatUserID;
	}

	public void setHideChatUserID(String hideChatUserID) {
		this.hideChatUserID = hideChatUserID;
	}

	public String getHideChatUserName() {
		return hideChatUserName;
	}

	public void setHideChatUserName(String hideChatUserName) {
		this.hideChatUserName = hideChatUserName;
	}

	public MainDisplayState getmDisplayState() {
		return mDisplayState;
	}

	public void setmDisplayState(MainDisplayState mDisplayState) {
		this.mDisplayState = mDisplayState;
	}

	public HideChatBarState getmHideChatBarState() {
		return mHideChatBarState;
	}

	public void setmHideChatBarState(HideChatBarState mHideChatBarState) {
		this.mHideChatBarState = mHideChatBarState;
	}

	public String toJson() {
		return new JSONSerializer().exclude("*.class").deepSerialize(this);
	}

	public static SaveStateConfig fromJsonToSaveStateConfig(String json) {
		return new JSONDeserializer<SaveStateConfig>().use(null,
				SaveStateConfig.class).deserialize(json);
	}

	public static String toJsonArray(Collection<User> collection) {
		return new JSONSerializer().exclude("*.class")
				.deepSerialize(collection);
	}

	public static Collection<SaveStateConfig> fromJsonArrayToSaveStateConfigs(
			String json) {
		return new JSONDeserializer<List<SaveStateConfig>>()
				.use(null, ArrayList.class)
				.use("values", SaveStateConfig.class).deserialize(json);
	}
}
